<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core" 
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:v="http://shale.apache.org/validator">

    <f:view>
        <f:loadBundle var="text" basename="#{basePage.bundleName}"/>
        <head>
            <title>#{text['inquiry.title']}</title>
            <meta name="menu" content="MainMenu"/>
            <meta name="heading" content="#{text['inquiry.heading']}"/>
        </head>

        <h:form id="inquiryForm" >

            <h:panelGrid columns="3">

                <h:panelGroup styleClass="info"><h:outputText value="#{text['inquiry.message']}"/></h:panelGroup>
                <h:outputText/><h:outputText/>


                <h:selectOneMenu value="#{inquiryForm.year}" id="year" required="true" styleClass="select">
                    <f:selectItems value="#{inquiryForm.years}"/>
                    <v:commonsValidator client="true" type="required" arg="#{text['inquiry.year']}"/>
                </h:selectOneMenu>
                <t:message for="year" styleClass="fieldError"/>
                <t:htmlTag value="p"><h:outputLabel for="year" value="#{text['inquiry.year']}"/></t:htmlTag>


                <h:selectOneMenu value="#{inquiryForm.month}" id="month" required="true" styleClass="select">
                    <f:selectItems value="#{inquiryForm.months}"/>

                 </h:selectOneMenu>
                <t:message for="month" styleClass="fieldError"/>
                <t:htmlTag value="p"><h:outputLabel for="month" value="#{text['inquiry.month']}"/></t:htmlTag>


                <h:selectOneMenu value="#{inquiryForm.week}" id="week" required="true" styleClass="select">
                    <f:selectItems value="#{inquiryForm.weeks}"/>

                </h:selectOneMenu>
                <t:message for="week" styleClass="fieldError"/>
                <t:htmlTag value="p"><h:outputLabel for="week" value="#{text['inquiry.week']}"/></t:htmlTag>

                <h:panelGroup styleClass="buttonBar bottom">
                    <h:commandButton value="#{text['button.view']}" action="#{inquiryForm.view}" id="view" styleClass="button"/>
                    
                    <h:commandButton value="#{text['button.download']}" action="#{inquiryForm.download}" id="download" styleClass="button"/>

                </h:panelGroup>
            </h:panelGrid>
            
       
                <t:dataTable id="inquiry" var="activity" style="margin-top: 10px"
                             value="#{inquiryForm.activitys}" rows="25" sortColumn="#{inquiryForm.sortColumn}"
                        sortAscending="#{inquiryForm.ascending}" styleClass="scrollerTable table"
                        headerClass="standardTable_Header" rowClasses="standardTable_Row1,standardTable_Row2"
                        columnClasses="standardTable_Column,standardTable_Column,standardTable_Column,standardTable_Column,standardTable_ColumnCentered">

                    <t:column>
                        <f:facet name="header">
                            <t:commandSortHeader columnName="id" arrow="true">
                                <h:outputText value="#{text['activity.id']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.id}" escape="true"/>
                    </t:column>

                    <t:column>
                        <f:facet name="header">
                            <t:commandSortHeader columnName="Date" arrow="true">
                                <h:outputText value="#{text['activity.activityDate']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.activityDate}" id="activityDate" styleClass="text large" >
                            <f:convertDateTime for="activityDate" pattern="#{text['date.format']}" type="date"  timeZone="GMT+7"/>
                        </h:outputText>
                    </t:column>
                    
                    <t:column>
                        <f:facet name="header">
                            <t:commandSortHeader columnName="TimeFrom" arrow="true">
                                <h:outputText value="#{text['activity.timeFrom']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.timeFrom.hours}:#{activity.timeFrom.minutes}" escape="true"/>
                    </t:column>
                    
                    <t:column>
                        <f:facet name="header">
                            <t:commandSortHeader columnName="TimeFrom" arrow="true">
                                <h:outputText value="#{text['activity.timeTo']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.timeTo.hours}:#{activity.timeTo.minutes}" escape="true"/>
                    </t:column>
                    
                    <t:column>
                        <f:facet name="header">
                            <t:commandSortHeader columnName="TimeFrom" arrow="true">
                                <h:outputText value="#{text['activity.type']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.type}" escape="true"/>
                    </t:column>
                    
                    <t:column>    
                        <f:facet name="header">
                            <t:commandSortHeader columnName="Name" arrow="true">
                                <h:outputText value="#{text['activity.name']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.name}" escape="true"/>
                    </t:column>
                    
                    <t:column>    
                        <f:facet name="header">
                            <t:commandSortHeader columnName="Name" arrow="true">
                                <h:outputText value="#{text['activity.activityCase']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.activityCase}" escape="true"/>
                    </t:column>
                    
                    <t:column>    
                        <f:facet name="header">
                            <t:commandSortHeader columnName="Name" arrow="true">
                                <h:outputText value="#{text['activity.icenterNo']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.icenterNo}" escape="true"/>
                    </t:column>
                    
                    <t:column>    
                        <f:facet name="header">
                            <t:commandSortHeader columnName="Name" arrow="true">
                                <h:outputText value="#{text['activity.activityStatus']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.activityStatus}" escape="true"/>
                    </t:column>
                    
                    <t:column>    
                        <f:facet name="header">
                            <t:commandSortHeader columnName="Name" arrow="true">
                                <h:outputText value="#{text['activity.location']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.location}" escape="true"/>
                    </t:column>
                    
                    <t:column>    
                        <f:facet name="header">
                            <t:commandSortHeader columnName="Name" arrow="true">
                                <h:outputText value="#{text['activity.remark']}" />
                            </t:commandSortHeader>
                        </f:facet>
                        <h:outputText value="#{activity.remark}" escape="true"/>
                    </t:column>
                    
                </t:dataTable>
            
            <ui:include src="/common/tableFooter.xhtml">
                <ui:param name="tableName" value="inquiry"/>
            </ui:include>
           
        </h:form>

                <!-- v:validatorScript functionName=" validateInquiryForm"/ -->

                <!--script type="text/javascript">
                    Form.focusFirstElement($('inquiryForm'));
                    highlightFormElements();
                </script -->

    </f:view>
</html>
